<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserEdit.ascx.cs" Inherits="Webadmin_Modules_User_UserEdit" %>
<script language="javascript" type="text/javascript" src="../../../JS/bizmac/bzUti.js"></script>
<script language="javascript" type="text/javascript" src="../../JS/bzAjax.js"></script>
<script language="javascript" type="text/javascript">
    var user_check_exist='1';
    var user_check_bool=-1;
    function User_checkSubmit()
    {   
        oEmail=document.getElementById('<%=this.txtEmail.ClientID %>');
         
        oUser=document.getElementById('<%=this.txtAdminUser.ClientID %>');
        oPass=document.getElementById('<%=this.txtPassword.ClientID %>');
        oPassConfirm=document.getElementById('<%=this.txtPasswordConfirm.ClientID %>');
        oCate=document.getElementById('<%=this.cboCategory.ClientID %>');
        if(!isEmailAddr(oEmail.value))
        {
            alert('<%=_AdminLang["Email_Invalid"] %>');
            oEmail.focus();
            return false;
        }
        if(oCate.value=='-1')
        {
            alert('<%=_AdminLang["UserList_CateEmpty"] %>');
            oCate.focus();
            return false;
        }
        if(oPass.value!=oPassConfirm.value)
        {
            alert('<%=_AdminLang["UserList_PasswordInvalid"] %>');
            oPass.focus();
            return false;
        }
        <%=_Act=="Edit"?"return true;":"" %>       
        if(user_check_bool==-1) createAjax('../../Request.aspx?Act=User&ID='+oUser.value,2);
        
        
        if(user_check_bool==1)
        {
            alert('<%=_AdminLang["UserList_Checking"] %>');
            document.getElementById('<%=this.btnUpdate.ClientID %>').focus();
            return false;
        }
        if(parseInt(user_check_exist,10)>0)
        {
            alert('<%=_AdminLang["UserList_Exist"] %>');
            oUser.focus();
            user_check_bool=-1;
            return false;
        }
        return true;
    }
</script>
 <form id="frmMain" runat="server" method="post" enctype="multipart/form-data" onsubmit="return User_checkSubmit();">
        <div align="center">
            <table width="90%" border="0" cellpadding="0" cellspacing="0" class="box_main">  
              <tr>
                <td width="100%" height="30" valign="top" class="navigator" align="left">&nbsp;<%=_Navigator %></td>
              </tr>
              <tr>
                <td valign="top" align="center">
		            <table class="box_into" width="98%" border="0" cellpadding="5" cellspacing="0">		            
		            <tr>
		  	            <td colspan="2" class="input_label" align="right" style="width: 34%">&nbsp;</td>
		  	            
		            </tr>
		            <tr>
		  	            <td  class="input_label" align="right" style="width: 27%">&nbsp;<%=_AdminLang["UserList_Category"] %></td>
		  	            <td  class="input_textbox" width="60%" align="left">
		  	                &nbsp; <asp:DropDownList ID="cboCategory" runat="server" AutoPostBack="false"  ></asp:DropDownList>
		  	            </td>
		            </tr>
		             <tr>
		  	            <td  class="input_label" align="right" style="width: 27%">&nbsp;<%=_AdminLang["UserList_Name"]%></td>
		  	            <td  class="input_textbox" width="60%" align="left">
		  	                &nbsp;<asp:TextBox ID="txtAdminUser" runat="server" Width="213px" onblur=" if(user_check_bool==-1 || user_check_bool==0) createAjax('../../Request.aspx?Act=User&ID='+this.value,2);"></asp:TextBox>
		  	                &nbsp;<asp:RequiredFieldValidator ID="reqAdinUser" runat="server" ControlToValidate="txtAdminUser" Display="Dynamic" Text="*" SetFocusOnError="true" ErrorMessage="*" ></asp:RequiredFieldValidator>
		  	                </td>
		            </tr>
		            <tr>
		  	            <td  class="input_label" align="right" style="width: 27%">&nbsp;<%=_AdminLang["UserList_Password"]%></td>
		  	            <td  class="input_textbox" width="60%" align="left">
		  	                &nbsp;<asp:TextBox ID="txtPassword" runat="server" Width="213px" TextMode="Password"></asp:TextBox>
		  	                &nbsp;<%if(_Act=="Add"){ %><asp:RequiredFieldValidator ID="reqPassword" runat="server" ControlToValidate="txtPassword" Display="Dynamic" Text="*" SetFocusOnError="true" ErrorMessage="*" ></asp:RequiredFieldValidator><%} %>
		  	                </td>
		            </tr>	
		            <tr>
		  	            <td  class="input_label" align="right" style="width: 27%">&nbsp;<%=_AdminLang["UserList_PasswordConfirm"]%></td>
		  	            <td  class="input_textbox" width="60%" align="left">
		  	                &nbsp;<asp:TextBox ID="txtPasswordConfirm" runat="server" Width="213px" TextMode="Password"></asp:TextBox>
		  	                &nbsp;<%if(_Act=="Add"){ %><asp:RequiredFieldValidator ID="reqConfirmPassword" runat="server" ControlToValidate="txtPasswordConfirm" Display="Dynamic" Text="*" SetFocusOnError="true" ErrorMessage="*" ></asp:RequiredFieldValidator><%} %>
		  	                </td>
		            </tr>	
		            <tr>
		  	            <td  class="input_label" align="right" style="width: 27%">&nbsp;<%=_AdminLang["UserList_Email"]%></td>
		  	            <td  class="input_textbox" width="60%" align="left">
		  	                &nbsp;<asp:TextBox ID="txtEmail" runat="server" Width="213px"></asp:TextBox>
		  	                &nbsp;<asp:RequiredFieldValidator ID="reqEmail" runat="server" ControlToValidate="txtEmail" Display="Dynamic" Text="*" SetFocusOnError="true" ErrorMessage="*" ></asp:RequiredFieldValidator>
		  	                </td>
		            </tr>	
		            
		                        	            
		             <tr>
		  	            <td  class="input_label" align="right" style="width: 27%">&nbsp;<%=_AdminLang["Enabled"] %></td>
		  	            <td  class="input_textbox" width="60%" align="left">
		  	            &nbsp;<asp:RadioButton ID="rdEnabled_1" runat="server" GroupName="rdEnabled"/>&nbsp;<%=_AdminLang["Enabled_1"]%>
		  	            &nbsp;<asp:RadioButton ID="rdEnabled_0" runat="server" GroupName="rdEnabled" Checked="true"/>&nbsp;<%=_AdminLang["Enabled_0"]%>
		  	            </td>
		            </tr>  
		            <tr>
		  	            <td  class="input_label" align="right" style="width: 27%">&nbsp;<%=_AdminLang["Forward"]%></td>
		  	            <td  class="input_textbox" width="60%" align="left">
		  	            &nbsp;<asp:RadioButton ID="rdForward_1" runat="server" GroupName="rdForward" />&nbsp;<%=_AdminLang["Forward_1"] %>
		  	            &nbsp;<asp:RadioButton ID="rdForward_0" runat="server" GroupName="rdForward" Checked="true"/>&nbsp;<%=_AdminLang["Forward_0"] %>
		  	            </td>
		            </tr>  
		            <tr>
		  	            <td colspan="2" class="input_label" align="right">&nbsp;<span style="color:#ff0000">*</span>&nbsp;<%=_AdminLang["RequireField"]%></td>
		  	            
		            </tr>     
		  		        <tr>
		  	                <td colspan="2" style="width: 77px; height: 10px;">&nbsp;</td>
		                </tr>	
		            </table>
                </td>
              </tr>
               <tr>
			            <td  height="22" valign="top" colspan="2" align="center">
			                <asp:Button ID="btnUpdate" Text="" runat="server" CssClass="btn_submit" OnClick="btnUpdate_Click"  />
			                <div class="back" style="float:right;margin-right:10px"><a href="<%=Session["Page"]%>"><%=_AdminLang["Back"] %></a></div>
			            </td>			
		              </tr>
              <tr>
  	            <td style="height: 19px">&nbsp;</td>
              </tr>
            </table>
          </div>         
       </form>    